<template>
	<section id="securityEmail">
		<HeaDer :Title='titleData'></HeaDer>
		<section class="emailWarp">
			<section class="title">
				<h2>绑定邮箱</h2>
			</section>
			<section class="formWarp">
				<van-cell-group>
					<van-field v-model="email" placeholder="请输入邮箱" type='email' icon="close" />
				</van-cell-group>
				<section class="btnWarp" @click="submit">
					<section class="btn">
						提交
					</section>
				</section>

			</section>
		</section>
	</section>
</template>

<script>
	import HeaDer from "../common/header.vue";
	export default {
		data() {
			return {
				email: '',
				titleData: {
					name: '',
					flat: 1
				},
			}
		},
		methods: {
			//点击提交执行函数
			submit() {
				var _this = this;
				if(!_this.$public.email(_this.email)) {
					_this.$toast('邮箱格式有误');
					return false;
				}
				_this.$http.post(_this.$host.binding_email, {
					email:_this.email,
					mobile: sessionStorage.mobile
				}).then(function(data) {
						_this.$toast(data.data.msg);
						if(data.data.status == 200){
							_this.$public.go('security',200,_this);
						}else{
							_this.email = '';
						}
				}).catch(function() {})

			}
		},
		components: {
			'HeaDer': HeaDer

		},
		created: function() {}
	}
</script>

<style>

</style>